--[[* 学会一个新技能]]

---@class BuffEffect682101 : BaseBuffEffect
BuffEffect682101 = ClientFight.CreateClass("BuffEffect682101", ClientFight.BaseBuffEffect)
local t = BuffEffect682101

function t:add(fight, buff)
    if (buff.target == buff.source) then
        return IBuffEffect.FAIL;
    end
    action(fight, buff);
    return ClientFight.BaseBuffEffect.add(self, fight, buff);
end
---@param fight Fight
---@param buff FighterBuff
function t:action(fight, buff, ...)
    local parameters = {...};
    -- 被援护者
    local target = buff.target;

    SkillManager.addSkill(fight, target, buff.buffBean.f_BuffEffectValue[1], 1);
    SkillRoleMgr.savePathFile("[" .. fight.frame .. "][EFFECT]Fighter " .. buff.target.fighterId .. " Buff:"
            .. buff.modelId .. " 学会一个新的技能:" .. buff.buffBean.f_BuffEffectValue[1]);
    return ClientFight.BaseBuffEffect.action(self, fight, buff, ...);
end

function t:remove(fight, buff, force, ...)
    SkillRoleMgr.savePathFile("[" .. fight.frame .. "][EFFECT]Fighter " .. buff.target.fighterId .. " Buff:"
            .. buff.modelId .. " 遗忘一个新的技能:" .. buff.buffBean.f_BuffEffectValue[1]);
    local skills = buff.target.skills;

    for k, v in pairs(skills) do
        if (v.getSkillId == buff.buffBean.f_BuffEffectValue[1]) then
            table.remove(skills, k);
        end
    end
    return ClientFight.BaseBuffEffect.remove(self, fight, buff,force, ...);
end
t.New()